import { Loadglb } from "./js/load_gltf.js";
import { Yuntai } from "./js/laser_machine.js";

let canvas = document.getElementById("renderCanvas");
let engine = new BABYLON.Engine(canvas, true);
let scene = new BABYLON.Scene(engine);
var ground = BABYLON.Mesh.CreateGround("ground1", 6, 6, 2, scene);

let assetsManager = new BABYLON.AssetsManager(scene);

// 可以反复加很多meshtask
let l=new Loadglb(assetsManager);
// let shelf=l.add_obj("shelf");
let box=l.add_obj("box");
let floor=l.add_obj("floor");
let gui=l.add_gui(scene);


 let yt = new Yuntai(scene);
 let scene2 = yt.createScene();
assetsManager.onFinish = function (tasks) {
  scene2.createDefaultCameraOrLight(true, true, true);
  scene2.createDefaultEnvironment();
  engine.runRenderLoop(function () {
    scene2.render();
  });
};

assetsManager.load();

// engine.runRenderLoop(function () {
//   scene1.render();
// });
window.addEventListener("resize", function () {
  engine.resize();
});
